package com.easylinkin.linkappapi.openapi.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.easylinkin.linkappapi.common.model.RequestModel;
import com.easylinkin.linkappapi.lobar.entity.EnUserGateLink;
import com.easylinkin.linkappapi.lobar.service.EnUserGateLinkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

/**
 * @author: kan yuanfeng
 * @Date: 2020/11/04 11:42
 * @Description: 管理人员管理人员闸机关联关联
 */
@RestController
@RequestMapping("openapi/enUserGateLink")
@Api(tags = "管理人员管理人员闸机关联关联")
public class OpenEnUserGateLinkController {
  
  @Autowired
  private EnUserGateLinkService enUserGateLinkService;

  /**
   * @Description: 人员同步到闸机
   * @author kan yuanfeng
   * @date 2020/11/04 11:42
   */
  @PostMapping
  @ApiOperation("人员同步到闸机")
  public RestMessage insert(@RequestBody List<JSONObject> jsonObjectList){
    if (null != jsonObjectList && jsonObjectList.size() > 0){
      //同步
      new Thread(() -> enUserGateLinkService.syncUser(jsonObjectList)).start();
    }
    return RestBuilders.successBuilder().build();
  }

}

